#include_function ".\..\..\lib\lib_all.txt"

//------------------------------------------------------------------------------
//	JEg_E
//	@SEDir		SEt@C̏ꏊ
//------------------------------------------------------------------------------
task CountDown(SEDir){
	let count = 9;
	
	loop{
		if(count == GetTimer()){
			PlaySE(SEDir);
			count -= 1;
		}
		yield;
	}
}

//------------------------------------------------------------------------------
//	蔻o^+{oA
//	@HitA		eɑ΂铖蔻
//	@HitB		@ɑ΂铖蔻
//	@BombBarrier	{oẢ
//	@HitWait	蔻o^܂ł̑҂
//------------------------------------------------------------------------------
task SetCollisionEx(HitA,HitB,BombBarrier,HitWait){
	loop(HitWait){
		yield;
	}
	loop{
		if( !(OnBomb() && BombBarrier) ){
			SetCollisionA(GetX(),GetY(),HitA);
			SetCollisionB(GetX(),GetY(),HitB);
		}
		yield;
	}
}

//------------------------------------------------------------------------------
//	_Ɉړ
//	@Radius	ړa
//	@WFrame	ړ҂
//	@MFrame	ړ
//	@MinX	ړŏxl
//	@MaxX	ړőxl
//	@MinY	ړŏyl
//	@MaxY	ړőyl
//------------------------------------------------------------------------------
task RandMove(Radius,WFrame,MFrame,MinX,MaxX,MinY,MaxY){
	let mvx = 0;
	let mvy = 0;
	let rnda = 0;
	
	loop{
		Wait(WFrame);
		rnda = rand(0,360);
		mvx = sin(rnda) * Radius;
		mvy = cos(rnda) * Radius;
		
		if(GetX() + mvx <= MinX || GetX() + mvx >= MaxX){
			mvx = -mvx;
		}
		if(GetY() + mvy <= MinY || GetY() + mvy >= MaxY){
			mvy = -mvy;
		}
		
		SetMovePosition02(GetX() + mvx,GetY() + mvy,MFrame);
	}
}

//------------------------------------------------------------------------------
//	ExɈړ
//	@WFrame	ړ҂
//	@MFrame	ړ
//	@MinX	ړŏxl
//	@MaxX	ړőxl
//	@MinY	ړŏyl
//	@MaxY	ړőyl
//------------------------------------------------------------------------------
task ExMove(WFrame,MFrame,MinX,MaxX,MinY,MaxY){
	let movex = 0;
	
	loop{
		Wait(WFrame);
		if(GetPlayerX() < MinX){
			movex = MinX;
		}
		else if(GetPlayerX() > MaxX){
			movex = MaxX;
		}else {
			movex = GetPlayerX();
		}
		SetMovePosition02(movex,rand(MinY,MaxY),MFrame);
	}
}

//------------------------------------------------------------------------------
//	Concentration01ɐF
//	@Time	ʎ
//	@Red	Rl
//	@Green	Gl
//	@Blue	Bl
//------------------------------------------------------------------------------
function ConcentRC(Time,Red,Green,Blue){
	SetColor(Red,Green,Blue);
	Concentration01(Time);
	SetColor(255,255,255);
	
	return;
}

//------------------------------------------------------------------------------
//	CreateItemg
//	@type	
//	@rnd	Ԃ͈
//	@num	Ƃ
//------------------------------------------------------------------------------
function CreateItemEx(type,rnd,num){
	let rrad = 0;
	let rang = 0;
	let bx = 0;
	let by = 0;
	
	loop(num){
		rrad = rand(0,rnd);
		rang = rand(0,360);
		bx = GetX() + cos(rang) * rrad;
		by = GetY() + sin(rang) * rrad;
		CreateItem(type,bx,by);
	}
	
	return;
}